package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        View jump = findViewById(R.id.jump);
        jump.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
            if (v.getId()==R.id.jump){
//               3种显式intent
                Intent intent1 = new Intent(this, MainActivity2.class);
                startActivity(intent1);

                Intent intent2 = new Intent();
                intent2.setClass(this,MainActivity2.class);
                startActivity(intent2);

                Intent intent3 = new Intent();
                ComponentName component = new ComponentName(this,MainActivity2.class);
                intent3.setComponent(component);
                startActivity(intent3);
            }
    }


}